Open
Conversation
7dff587 to
a4fa47f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the new Compose-based FrontendScreen (Frontend V2) to support entering Android Picture-in-Picture (PiP) mode via LaunchActivity, by reporting when PiP-eligible content is visible (fullscreen Media3/ExoPlayer overlay or a WebView custom view) and using that snapshot to enter PiP when the user backgrounds the app.
Changes:
- Add
PipReadinesssnapshot model + reporting pipeline fromFrontendScreen→HAApp/HANavHost→LaunchActivity/LaunchViewModel - Enter PiP from
LaunchActivity.onUserLeaveHint()when PiP is supported and the current screen reports eligibility - Enable PiP in manifests and add unit/Robolectric test coverage for readiness computation and PiP entry behavior
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| automotive/src/main/AndroidManifest.xml | Enables PiP support for Automotive LaunchActivity |
| automotive/lint-baseline.xml | Updates lint baseline metadata/locations and adds a new baseline entry related to the PiP SDK check |
| app/src/main/AndroidManifest.xml | Enables PiP support for app LaunchActivity |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchActivity.kt | Enters PiP on user-leave when eligible content is reported |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/LaunchViewModel.kt | Stores latest PipReadiness from the UI layer for the activity to read |
| app/src/main/kotlin/io/homeassistant/companion/android/launch/PipReadiness.kt | New model + computation/clamping logic for PiP aspect ratio eligibility |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HAApp.kt | Plumbs onPipReadinessChanged callback into app scaffold/nav host |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/HANavHost.kt | Plumbs onPipReadinessChanged into the frontend destination |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/navigation/FrontendNavigation.kt | Adds onPipReadinessChanged parameter to the frontend route composable |
| app/src/main/kotlin/io/homeassistant/companion/android/frontend/FrontendScreen.kt | Computes and publishes PipReadiness from overlays (custom view / fullscreen player) |
| app/src/test/kotlin/io/homeassistant/companion/android/launch/LaunchViewModelTest.kt | Adds tests for pipReadiness state behavior in the ViewModel |
| app/src/test/kotlin/io/homeassistant/companion/android/launch/LaunchActivityTest.kt | Adds Robolectric tests validating PiP entry behavior on onUserLeaveHint() |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/PipReadinessTest.kt | Adds Robolectric tests for readiness/aspect clamping logic |
| app/src/test/kotlin/io/homeassistant/companion/android/frontend/FrontendScreenTest.kt | Adds Compose/Robolectric tests ensuring readiness is published from FrontendScreenContent |
Comment on lines
+215
to
+217
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return | ||
| if (!packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) return | ||
| val readiness = viewModel.pipReadiness.value ?: return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Based on #6790 to add support for PiP in
FrontendScreenusing the LauncherActivity.Checklist